﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using System.Collections.Generic;
using System.Threading.Tasks;
using Zocono.WCS.Admin.Common;
using Zocono.WCS.Application.AppEquipmentManage;
using Zocono.WCS.Application.AppTraces;
using Zocono.WCS.Domain.EntityInfo;

namespace Zocono.WCS.Admin.Controllers.MonitorManageMoudle
{
    public class MonitorEditorController : BaseController
    {
        private readonly MonitorApp _MonitorApp;


        public MonitorEditorController(IMemoryCache memoryCache, MonitorApp monitorApp, TracesApp tracesApp, IHttpContextAccessor httpContextAccessor) : base(memoryCache, tracesApp, httpContextAccessor)
        {
            _MonitorApp = monitorApp;
        }
        [BasicAuth]
        public IActionResult Index()
        {

         
            return View();
        }
        /// <summary>
        /// 获取当前楼的配置
        /// </summary>
        /// <returns></returns>
        public async Task<List<MonitorConfigInfo>> GetMonitorConfigInfoByFloorAsync()
        {
            var floor = Request.Form["floor"].ToString();

            return await _MonitorApp.GetMonitorConfigInfoByFloorAsync(floor);
        }

        /// <summary>
        /// 获取当前楼层的配置
        /// </summary>
        /// <returns></returns>
        public async Task<bool> UpdateMonitorConfigInfoByLayerAsync()
        {
            var layer = Request.Form["layer"].ToString();
            var json = Request.Form["json"].ToString();
            return await _MonitorApp.UpdateMonitorConfigInfoByLayerAsync(layer,json);
        }
    }
}
